import 'package:flutter/cupertino.dart';
import 'package:jetour_line/pages/common/commonDetail/common_detail_page.dart';
import 'package:jetour_line/pages/line/lineDetail/line_detail_page.dart';
import 'package:jetour_line/utils/login_utils.dart';
import 'package:jetour_line/utils/page_push_utils.dart';

typedef _ShareCallBack = void Function(int type, String title,String subTitle,String logo,String url);
typedef _LoginCallBack = void Function(Function function);
typedef _GoJetourCallBack = void Function(String path);

class AhaManger {

  // 静态变量
  static final AhaManger _singleton = AhaManger._internal();
  factory AhaManger() {
    return _singleton;
  }
  AhaManger._internal();
  String? _token ;
  String? searchCityName ;
  int? searchCityId ;
  bool isUat  = true;
  void setToken(String token){
    _token = token;
    print("aha_setToken$token");
  }
  String getToken(){
    if(_token == null){
      return '';
    }
     return _token!;
  }
  void logOut(){
    _token = null;
    LoginUtils.logOut();
  }
  /// type: 1 路书详情  2 共创详情   id:路书、共创id
  void goAhaViewPage(BuildContext context, int type,String id){
    if(type == 1){//101209
      PagePushUtils.push(context, LineDetailPageScreen(id: int.parse(id)));
    }else if(type == 2){//150
      PagePushUtils.push(context, CommonDetailScreen(id: int.parse(id)));
    }
  }
  // 其他方法
  _ShareCallBack? shareCallBack;
  _LoginCallBack? loginCallBack;
  _GoJetourCallBack? goJetourCallBack;
}